<template>
	<div class="xinxishenhe">
		<uni-nav-bar :fixed="true" title="信息详情" background-color="#5C7FF5" status-bar @clickLeft="back" :dark="true"
			left-icon="left">
		</uni-nav-bar>
		<div>
			<div class="p30 bgwhite">
				<div class="infoItem">
					<div class="infoItem_label">运营单位</div>
					<div class="infoItem_content">{{ form.org }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">所属电站</div>
					<div class="infoItem_content">{{ form.station }}</div>
				</div>
				<div class="infoItem noboderbottom">
					<div class="infoItem_label">电压等级</div>
					<div class="infoItem_content">{{ form.voltage }}</div>
				</div>

			</div>
			<div class="line"></div>
			<div class="p30 bgwhite">
				<div class="infoItem">
					<div class="infoItem_label">设备类型</div>
					<div class="infoItem_content">{{ form.deviceType }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">设备名称</div>
					<div class="infoItem_content">{{ form.deviceName }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">缺陷部位</div>
					<div class="infoItem_content">{{ form.partsType }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">缺陷描述</div>
					<div class="infoItem_content quexian_word">{{ form.description }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">分类依据</div>
					<div class="infoItem_content">{{ form.classificationBasis }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">缺陷性质</div>
					<div class="infoItem_content">{{ form.level }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">巡检人员</div>
					<div class="infoItem_content">{{ form.username2 }}</div>
				</div>
				<!-- <div class="infoItem noboderbottom" v-if="rules ==1">
					<div class="infoItem_label">巡检人员</div>
					<div class="infoItem_content">{{ form.username2 }}</div>
				</div> -->
				<div class="infoItem noboderbottom">
					<div class="infoItem_label">巡检时间</div>
					<div class="infoItem_content">{{ form.time }}</div>
				</div>
			</div>
			<div class="line"></div>
			<div class="p30 bgwhite">
				<div class="infoItem">
					<div class="infoItem_label">设备型号</div>
					<div class="infoItem_content">{{ form.model }}</div>
				</div>
				<div class="infoItem">
					<div class="infoItem_label">生产厂家 </div>
					<div class="infoItem_content">{{ form.manufacturer }}</div>
				</div>
				<div class="infoItem noboderbottom">
					<div class="infoItem_label">投运日期</div>
					<div class="infoItem_content">{{ form.date }}</div>
				</div>
			</div>
			<div class="line"></div>
			<div class="p50 bgwhite imgdiv" style="margin: 16rpx 0;">
				<uni-file-picker limit="1" multiple @success="success" @progress="progress" @fail="fail"
					@delete="deletes" :disabled="true" @select="select" :readonly="true" :del-icon="true"
					v-model="fileLists">
					<img src="../../static/img/isAdd.png" style="width: 72rpx;height: 60rpx;" alt="">
				</uni-file-picker>
			</div>

			<div style="box-shadow: 0px 3px 6px 1px rgba(0,0,0,0.16);box-sizing: border-box;display: flex;align-items:center;justify-content: space-between;width: 100%;height: 88rpx;background-color: white;font-weight: 500;font-size: 28rpx;color: #262626;line-height: 88rpx;letter-spacing: 1rpx;padding:0rpx 50rpx;margin-top: 16rpx;"
				@click="toshenhezhedie(item,index)" v-for="(item,index) in form.defectRecodes" :key="index">
				<div>{{'消缺审核信息'+(index+1)}}</div>
				<img style="font-size: 40rpx;width: 20rpx;height: 40rpx;" src="../../static/img/tu.png" alt="" />
			</div>


			<!-- <uni-section title="手风琴效果（只会保留一个的打开状态）" type="line"> -->
			<!-- 	<uni-collapse @change="onCollapseChange" ref="collapse" v-model="accordionVal" class="uni-collapse"
				style="background-color: transparent;"> -->
			<!-- <uni-collapse-item title="消缺审核信息1" @click="toshenhezhedie"> -->
			<!-- <view class="content">
						<div class="titles">消缺信息</div>
						<div class="p50 bgwhite imgdiv" style="margin-top: 16rpx;">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
						</div>
						<div class="p50 bgwhite">
							<div class="infoItem">
								<div class="infoItem_label">消缺人员</div>
								<div class="infoItem_content">{{ form.solveName }}</div>
							</div>
							<div class="infoItem">
								<div class="infoItem_label">消缺时间</div>
								<div class="infoItem_content">{{ form.solveTime }}</div>
							</div>
							<div class="infoItem" style="border-bottom: 0rpx;">
								<div class="infoItem_label">备注</div>
								<div class="infoItem_content">{{ form.solveRemarks }}</div>
							</div>
						</div>


						<div class="titles">审核信息</div>

						<div class="p50 bgwhite">
							<div class="infoItem">
								<div class="infoItem_label">审核结果</div>
								<div class="infoItem_content">{{ '不通过' }}</div>
							</div>
							<div class="infoItem">
								<div class="infoItem_label">审核时间</div>
								<div class="infoItem_content">{{ '2024-9-14 11:00' }}</div>
							</div>
							<div class="infoItem" style="border-bottom: 0rpx;">
								<div class="infoItem_label">原因</div>
								<div class="infoItem_content">{{ '缺陷未消缺，还存在隐患，隔离开关上接线漏电未处理' }}</div>
							</div>
						</div>
						<div class="p50 bgwhite imgdiv" style="margin-top: 16rpx;">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
						</div>
					</view> -->
			<!-- </uni-collapse-item> -->
			<!-- <uni-collapse-item title="消缺审核信息2"> -->
			<!-- <view class="content">
						<div class="titles">消缺信息</div>
						<div class="p50 bgwhite imgdiv" style="margin-top: 16rpx;">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
						</div>
						<div class="p50 bgwhite">
							<div class="infoItem">
								<div class="infoItem_label">消缺人员</div>
								<div class="infoItem_content">{{ form.solveName }}</div>
							</div>
							<div class="infoItem">
								<div class="infoItem_label">消缺时间</div>
								<div class="infoItem_content">{{ form.solveTime }}</div>
							</div>
							<div class="infoItem" style="border-bottom: 0rpx;">
								<div class="infoItem_label">备注</div>
								<div class="infoItem_content">{{ form.solveRemarks }}</div>
							</div>
						</div>


						<div class="titles">审核信息</div>

						<div class="p50 bgwhite">
							<div class="infoItem">
								<div class="infoItem_label">审核结果</div>
								<div class="infoItem_content">{{ '不通过' }}</div>
							</div>
							<div class="infoItem">
								<div class="infoItem_label">审核时间</div>
								<div class="infoItem_content">{{ '2024-9-14 11:00' }}</div>
							</div>
							<div class="infoItem" style="border-bottom: 0rpx;">
								<div class="infoItem_label">原因</div>
								<div class="infoItem_content">{{ '缺陷未消缺，还存在隐患，隔离开关上接线漏电未处理' }}</div>
							</div>
						</div>
						<div class="p50 bgwhite imgdiv" style="margin-top: 16rpx;">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
							<img src="../../static/img/11.png" style="width: 298rpx;height: 212rpx;" alt="">
						</div>
					</view> -->
			<!-- 	</uni-collapse-item>
			</uni-collapse> -->


		</div>
		<div class="addBtn" @click="toXq">
			<div class="bts xq">消缺</div>
		</div>
	</div>
</template>




<script>
	import uniNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue'
	import unicollapse from '@/uni_modules/uni-collapse/components/uni-collapse/uni-collapse'
	import {
		nowDay
	} from "@/utils/filters"
	import dialogs from "@/components/dialog.vue";
	import {
		COM_URL,
		IMG_URL
	} from "@/utils/config";
	import {
		findDefectByCode
	} from '@/utils/http'
	export default {
		onLoad(query) {
			this.getInfo(query.code)
			this.rule = uni.getStorageSync('userInfo').role
			this.isMyself = uni.getStorageSync('openid')
			this.comeForm = query.u
		},

		onShow() {
			this.rules = uni.getStorageSync('userInfo').userId

		},

		components: {
			dialogs,
			uniNavBar,
			unicollapse
		},

		data() {
			return {
				value: ['0'],
				accordionVal: '1',
				content: '折叠内容主体，可自定义内容及样式，点击按钮修改内容使高度发生变化。',
				extraIcon: {
					color: '#4cd964',
					size: '26',
					type: 'image'
				},
				current: 0,
				form: {},
				fileLists: [],
				fileLists1: [],
				deldatas: [],
				rule: '',
				isMyself: '',
				sameDay: null,
				comeForm: "",
				rules: "",


			};
		},

		methods: {
			toXq() {
				// console.log(this.form.code)
				uni.navigateTo({
					url: '/pages/order/xiaoqueright?code=' + this.form.code
				})
			},
			toshenhezhedie(item, index) {
				// console.log(888888888)
				// uni.navigateTo({
				// 	url: '/pages/order/shehezhedie?info=' + encodeURIComponent(JSON.stringify(item)) + '&num' +
				// 		encodeURIComponent(JSON.stringify(index))
				// })
				uni.navigateTo({
					url: '/pages/order/shehezhedie?info=' + encodeURIComponent(JSON.stringify(item)) +
						`&num=${index}`
				})
			},
			clickpass(item, index) {
				this.current = index
			},
			onCollapseChange() {
				this.$nextTick(() => {
					this.$refs.collapse.resize()
				})
			},
			back() {
				uni.navigateBack({
					delta: 1 // 默认值是1，表示回退到上一页，如果要回退多级可以设置大于1的数值
				});
			},

			// 删除
			toDel() {
				this.deldatas = [this.form.id]
				this.$refs.dialog.$refs.inputDialog.open();


			},
			toEdit() {
				uni.navigateTo({
					url: '/pages/order/infoEdit?code=' + this.form.code
				})

			},
			// 消缺
			toright() {
				uni.navigateTo({
					url: '/pages/order/xiaoqueright?code=' + this.form.code
				})
			},
			getInfo(code) {
				findDefectByCode({
					code
				}).then(res => {
					this.form = res.result
					this.sameDay = nowDay() == this.form.time.split(' ')[0]
					if (this.form.pic && this.form.pic.length > 0) {
						this.form.pic.forEach(item => {
							this.fileLists.push({
									url: IMG_URL + item.path,
									code: item.code,
									id: item.id,
									fileID: item.code,
									path: item.path,
									paths: item.paths,
								}

							)
						})
					}
					// if (this.form.pics && this.form.pics.length > 0) {
					// 	this.form.pics.forEach(item => {
					// 		this.fileLists1.push({
					// 				url: IMG_URL + item.path,
					// 				code: item.code,
					// 				id: item.id,
					// 				fileID: item.code,
					// 				path: item.path,
					// 				paths: item.paths,
					// 			}

					// 		)
					// 	})
					// }
				})
			},

		}
	};
</script>
<style scoped lang="scss">
	.xinxishenhe {
		box-sizing: border-box;
		// padding:0rpx 50rpx;
		height: 100%;
		background: #F5F6F8;

		.noboderbottom {
			border-bottom: none !important;
		}

		.paizhao {
			display: flex;
			flex-direction: column;
			// height: 200rpx;
			justify-content: space-around;
			// border: 1px solid red;

			.infoItem_label {
				width: 200rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: 500;
				font-size: 28rpx;
				height: 50rpx;
				line-height: 50rpx;
			}
		}


		.infoItem {
			padding: 20rpx 0;
			display: flex;
			justify-content: space-around;
			border-bottom: 1rpx solid #b1aeae;

			.infoItem_label {
				width: 200rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: 500;
				font-size: 28rpx;

			}

			.infoItem_content {
				margin-left: 80rpx;
				flex-wrap: wrap;
				text-align: right;
				flex: 1;
				font-family: Source Han Sans CN, Source Han Sans CN;
				font-weight: 400;
				font-size: 28rpx;
				color: #262626;
			}
		}

		.line {
			height: 16rpx;
		}
	}

	.pImg {
		margin-top: 20rpx;
		width: 298rpx;
		height: 212rpx;
	}

	.hasFlex {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
	}

	.addBtn {
		margin-top: 30rpx;
		padding-bottom: 30rpx;
		line-height: 80rpx;

		display: flex;
		justify-content: space-around;

		.bts {
			text-align: center;
			width: 300rpx;
			height: 80rpx;

			box-shadow: 0rpx 3rpx 6rpx 1rpx rgba(0, 0, 0, 0.16);
			border-radius: 12rpx 12rpx 12rpx 12rpx;
			font-family: Source Han Sans CN, Source Han Sans CN;
			font-weight: 500;
			font-size: 36rpx;

		}

		.xq {
			width: 600rpx !important;
			background: #5C7FF5 !important;
			color: #FFFFFF !important;
		}
	}

	.inputdiv {
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		padding: 20rpx 0;
		border-bottom: 1rpx solid #b1aeae;
		height: 180rpx;
		margin-bottom: 25rpx;

		.infoItem_label {
			width: 200rpx;
			font-family: Source Han Sans CN, Source Han Sans CN;
			font-weight: 500;
			font-size: 28rpx;
		}

		.infoItem_content {
			// margin-left: 80rpx;
			// flex-wrap: wrap;
			// // text-align: right;
			// flex: 1;
			height: 80rpx;
			font-family: Source Han Sans CN, Source Han Sans CN;
			font-weight: 400;
			font-size: 28rpx;
			color: #262626;
			border-radius: 6px 6px 6px 6px;
			border: 2px solid #707070;
		}
	}

	.uni-collapse .content {}
</style>
<style scoped>
	.xinxishenhe>>>.uni-nav-bar-text {
		font-size: 35rpx;
	}


	.p30 {
		padding: 20rpx 30rpx;

	}

	.p50 {
		padding: 20rpx 50rpx;

	}

	.bgwhite {
		background: white;
		box-shadow: 0rpx 3rpx 6rpx 1rpx rgba(0, 0, 0, 0.16);
	}

	>>>.uni-collapse {
		background-color: transparent;
	}

	.uni-collapse>>>.uni-collapse-item__title-text {
		/* font-family: Source Han Sans CN, Source Han Sans CN; */
		font-weight: 500;
		font-size: 28px;
		color: #262626;
		/* line-height: 22px; */
		letter-spacing: 1px;
		/* text-align: left;
		font-style: normal;
		text-transform: none; */
	}

	.uni-collapse>>>.uni-collapse-item {
		height: 88rpx;
		margin-top: 16rpx;
		line-height: 88rpx;
	}

	.uni-collapse>>>.uni-collapse-item__title-box {
		height: 100%;
		line-height: 88rpx;
	}

	.uni-collapse>>>.uni-collapse-item__title-wrap {
		height: 100%;
	}

	.imgdiv {
		/* height: 277rpx; */
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 30rpx;
	}



	.xinxishenhe>>>.icon-del-box {
		display: none;
		width: 40rpx;
		height: 40rpx;
		background-color: red;
	}

	.xinxishenhe>>>.icon-del {
		width: 20rpx;
		height: 4rpx;
	}

	.titles {
		font-family: Source Han Sans CN, Source Han Sans CN;
		font-weight: bold;
		font-size: 30rpx;
		color: #313131;
		margin-top: 10rpx;
		box-sizing: border-box;
		padding-left: 40rpx;
	}
</style>